// @charset "utf-8";

define(function(require, exports, module) {
	var chartOptions = {
		chart: {
			backgroundColor: null,
			type: 'solidgauge',
			style: {
				"fontFamily": "Arial, \"Microsoft yahei\", Verdana, Helvetica, sans-serif",
				"fontSize": "12px",
				"fontWeight": "normal"
			}
		},
		title: '',
		pane: {
			center: ['50%', '85%'],
			size: '140%',
			startAngle: -90,
			endAngle: 90,
			background: {
				backgroundColor: '#7c7c7c',
				innerRadius: '60%',
				borderWidth: '2px',
				borderColor: '#323232',
				outerRadius: '100%',
				shape: 'arc'
			}
		},

		tooltip: {
			enabled: false
		},

		yAxis: {
			stops: [
				[0.2, '#2fb56b'],
				[0.4, '#71be40'],
				[0.6, '#f8e43b'],
				[0.8, '#da6a10'],
				[1, '#bf2121']
			],
			lineWidth: 0,
			minorTickInterval: null,
			tickInterval: 20,
			tickWidth: 0,
			title: {
				y: -70
			},
			labels: {
				distance: 8,
				useHTML: true,
				formatter: function() {
					if (this.value == 0) {
						return '<span style="color:#189c53;font-size:12px;">弱</span>';
					} else if (this.value == 20) {
						return '<span style="color:#2fb56b">' + this.value + '</span>';
					} else if (this.value == 40) {
						return '<span style="color:#71be40">' + this.value + '</span>';
					} else if (this.value == 60) {
						return '<span style="color:#e2bb34">' + this.value + '</span>';
					} else if (this.value == 80) {
						return '<span style="color:#da6a10">' + this.value + '</span>';
					} else if (this.value == 100) {
						return '<span style="color:#bf2121;font-size:12px;">强</span>';
					}
				}
			}
		},

		plotOptions: {
			solidgauge: {
				dataLabels: {
					y: 10,
					borderWidth: 0,
					useHTML: true
				}
			},
			series: {
				marker: {
					lineWidth: 10
				},
				pointPadding: 0, //数据点之间的距离值
				groupPadding: 0, //分组之间的距离值
				// borderWidth: 10,
				shadow: false,
				pointWidth: 5 //柱子之间的距离值
			}
		}
	};
	var explainChart = {
		HighchartsObj: null,
		renderChart: function(data) {
			$('.qrpj-explain-pic').highcharts(Highcharts.merge(chartOptions, {
				yAxis: {
					min: 0,
					max: 100,
					title: {
						text: null
					}
				},

				credits: {
					enabled: false
				},

				series: [{
					innerSize: '10%',
					name: 'Speed',
					data: [data],
					dataLabels: {
						format: '<div style="text-align:center"><span style="font-size:12px;color:#dedede;font-weight:normal;">涨停个数</span><br/>' +
							'<span style="font-size:12px;color:#dedede;font-weight:normal;">{y}</span></div>'
					},
					lineWidth: 10
				}]
			}));
			this.HighchartsObj = $('.qrpj-explain-pic').highcharts();
		},
		updateSeries: function(data) {

		}
	};

	module.exports = explainChart;
});